<!doctype html>
<html lang="zh-CN">
  <head>
    <!-- 必须的 meta 标签 -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

   
    <title>Rabbit MQ  Test</title>
    <style>
        
    </style>
  </head>
  <body>
    <div id="screen">
        <div id="bgImg">
            <img></img>
        </div>
    </div>

    <div class="opera">

    </div>

    <script>
        if(WebSocket == undefined){
            alert("not suppose current Web Browser");
        }
        // Create WebSocket connection.
        const socket = new WebSocket("ws://localhost:8091");

        // Connection opened
        socket.addEventListener("open", function (event) {
            alert("connect opened!");
            console.warn(event)
            //socket.send("Hello Server!");
        });

        // Connection opened
        socket.addEventListener("close", function (event) {
            alert("connect closed!");
            console.error(event)
            //socket.send("connect closed");
        });

        // Connection opened
        socket.addEventListener("error", function (event) {
            alert("connect error!");
            console.error(event)
            // socket.send("connect error");
        });

        // Listen for messages
        socket.addEventListener("message", function (event) {
            console.log("Message from server ", event.data);
        });


    </script>

  </body>
</html>